<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Person(name,age){
            this.name = name;
            this.age = age;
            this.sayName = sayName;
        }

        function sayName(){
            console.log(this.name);
        }
        
        var person1 = new Person("同学A",18);
        var person2 = new Person("同学B",18);

        person1.sayName();
        person2.sayName();
    </script>
</head>
<body>
    
</body>
</html>